package com.example.demo.service;

import com.example.demo.mapper.AppxMapper;
import org.apache.ibatis.solon.annotation.Db;
import org.noear.solon.data.annotation.Tran;
import org.noear.solon.data.tran.TranPolicy;
import org.noear.solon.annotation.Component;

/**
 * app信息服务层
 *
 * @author raos
 * @date 2024/3/6
 **/
@Component
public class AppxService {

    @Db
    AppxMapper appxMapper;

    public Object getApp(int appId) throws Exception {
        return appxMapper.appxGet2(appId);
    }

    public Object getApp(String appId) throws Exception {
        return appxMapper.appxGet2(Integer.parseInt(appId));
    }

    public void addApp() {
        appxMapper.appxAdd();
    }

    @Tran
    public void addApp2() {
        appxMapper.appxAdd();
    }

    @Tran(policy = TranPolicy.nested)
    public void addApp3() {
        appxMapper.appxAdd();
    }

    @Tran(policy = TranPolicy.requires_new)
    public void addApp4() {
        appxMapper.appxAdd();
    }

    @Tran(policy = TranPolicy.never)
    public void addApp5() {
        appxMapper.appxAdd();
    }

    @Tran(policy = TranPolicy.mandatory)
    public void addApp6() {
        appxMapper.appxAdd();
    }

}
